package com.wang.friend.domain.question.es;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDateTime;

/**
 * 题目实体类
 */
@Setter
@Getter
@Document(indexName = "idx_question")
public class QuestionES {

    @Schema(description = "题目id")
    @Id
    @Field(type = FieldType.Long)
    private Long questionId;

    @Schema(description = "题目标题")
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String title;

    @Schema(description = "难度")
    @Field(type = FieldType.Byte)
    private Integer difficulty;

    @Schema(description = "时间限制")
    @Field(type = FieldType.Long)
    private Long timeLimit;

    @Schema(description = "空间限制")
    @Field(type = FieldType.Long)
    private Long spaceLimit;

    @Schema(description = "内容")
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String content;

    @Schema(description = "测试用例")
    @Field(type = FieldType.Text)
    private String questionCase;

    @Schema(description = "主函数")
    @Field(type = FieldType.Text)
    private String mainFuc;

    @Schema(description = "默认代码")
    @Field(type = FieldType.Text)
    private String defaultCode;

    @Schema(description = "创建时间")
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private LocalDateTime createTime;
}
